<template>
  <div>
    <detailYgdaFrom
      v-if="isDetail"
      :employeeId="employeeId"
      :checkStatus="checkStatus"
    ></detailYgdaFrom>
    <div
      v-else
      style="
        font-size: 16px;
        font-weight: 600;
        margin-top: 100px;
        text-align: center;
      "
    >
      <p><img src="@/assets/images/icon/empty.png" /></p>
      <p>未匹配相关档案数据</p>
    </div>
  </div>
</template>

<script setup name="personalFile">
import { listEmployee } from '@/api/rsgl/ygda'
import { getCurrentInstance, reactive, toRaw, toRefs } from 'vue'
import useUserStore from '@/store/modules/user'

import detailYgdaFrom from '../detailYgda/index.vue'
const { proxy } = getCurrentInstance()
const userStore = useUserStore()
const data = reactive({
  employeeId: '',
  checkStatus: '',
  isDetail: false,
  // 查询参数
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    searchValue: undefined
  }
})
const { queryParams, employeeId, isDetail, checkStatus } = toRefs(data)
function init() {
  /** 查询用户列表 */
  const userName = userStore.user.userName
  console.log(userStore.user)
  queryParams.value.searchValue = userName
  listEmployee(queryParams.value).then(response => {
    const employeeList = response.rows
    employeeId.value = employeeList.find(item => item.employeeNo == userName)
      ? employeeList.find(item => item.employeeNo == userName).employeeId
      : ''
    checkStatus.value =
      response.rows.length > 0 ? response.rows[0].checkStatus : ''
    if (employeeId.value) {
      isDetail.value = true
    }
  })
}
init()
</script>

<style scoped lang="scss"></style>
